package org.objective.dal.commands;

import org.common.service.ServiceRegister;
import org.objective.base.BaseFieldInfo;
import org.objective.command.AuthToken;
import org.objective.command.Command;
import org.objective.command.CommandResult;
import org.objective.service.DalService;
import static org.utils.fp.collection.CollectionFactory.*;

/**
 *
 * @author gus
 */
public class LoadFieldInfoCommand implements Command<BaseFieldInfo>
{
    private static final long serialVersionUID = 5238734363720622929L;
    private long fieldID;

    public LoadFieldInfoCommand(long fieldId)
    {
        this.fieldID = fieldId;
    }

    @Override
    public Object[] getParameters()
    {
        return array(fieldID);
    }

    @Override
    public CommandResult<BaseFieldInfo> execute(ServiceRegister provider, AuthToken token) throws Exception
    {
        DalService service = provider.getService(DalService.class);
        return service.loadFieldInfo(fieldID);
    }
}
